﻿@model IEnumerable<vngoodlife.Article>

<table width="100%">
                    <tr>
                        <td>
                            <div id="tablewrapper">
                                <div id="tableheader">
                                    <div class="search">
                                        <select id="columns" onchange="sorter.search('query')">
                                        </select>
                                        <input type="text" id="query" onkeyup="sorter.search('query')" style="width:170px;" />
                                    </div>
                                    <div class="details">
                                        <div class="ddl">
                                             
                                            
                                        </div>
                                        <div>
                                            Kết quả
                                            <span id="startrecord"></span>-<span id="endrecord"></span>
                                            của
                                            <span id="totalrecords"></span>
                                        </div>
                                        <div><a href="javascript:sorter.reset()">Thiết lập lại</a></div>
                                    </div>
                                </div>
                                <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
                                    <thead>
                                        <tr>
                                           <th><h3>Mã số</h3></th>
                                           <th class="nosort"><h3>Ảnh</h3></th>
                                            <th><h3>Tiêu đề</h3></th>
                                            <th><h3>View</h3></th>
                                            <th><h3>Thành viên</h3></th>
                                            <th><h3>Quản lý</h3></th>
                                            <th><h3>Lần sửa cuối</h3></th>
                                            
                                            <th class="nosort"><h3>Xem nhanh</h3></th>
                                            <th class="nosort"><h3>Ẩn/Hiện</h3></th>
                                            <th class="nosort"><h3>Sửa</h3></th>
                                            <th class="nosort"><h3>Xóa</h3></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        
                                        @foreach (var item in Model)
                                        { 
                                        <tr>
                                            <td style="width: 50px; text-align: center;">
                                                @item.ArticleID
                                            </td>
                                            <td style="text-align: center;">
                                                 <img src="../../../Content/images/article/thumbnail/@item.Photo" alt="@item.Photo"  class="img70x70"/>
                                            </td>
                                            <td style="text-align: center;">
                                                @item.Title 
                                            </td>
                                            <td style="width: 40px; text-align: center;">
                                                @item.ViewNumber
                                            </td>
                                            <td style="width: 90px; text-align: center;">
                                                @item.MemberName
                                            </td>
                                            <td style="text-align: center;">
                                                @item.AdminName
                                            </td>
                                            <td style="width: 90px; text-align: center;">
                                                @String.Format(vngoodlife.Util.ConstantClass._dateTimeFormat, item.CreateDate)
                                            </td>

                                            <td style="width:70px; text-align: center;">
                                                  @if (item.ArticleVisible)
                                                  {
                                                 <a href="@Url.RouteUrl("ArticleDetailFrontend", new { articleSeoUrl = item.ArticleSeoUrl })" target="_blank">
                                                    <img src="../../../Content/table/images/grid_preview.png" alt="Xem nhanh" title="Xem nhanh"/></a>
                                                  } 
                                            </td>
                                            <td style="width:50px;text-align: center">
                                                @if (item.ArticleVisible)
                                                {
                                                    <span style="color:Green">hiện</span>
                                                }
                                                else
                                                {
                                                    <span style="color:Red">ẩn</span>
                                                }
                                            </td>
                                            <td style="width:50px;text-align: center">
                                               <a href="@Url.Action("ArticleEdit", "Article", new { articleID = item.ArticleID })">
                                               <img src="../../../Content/table/images/grid_edit.png" alt="Chỉnh sửa" title="Chỉnh sửa bài viết"/></a>
                                            </td>
                                            <td style="width:50px;text-align: center">
                                                @using (Html.BeginForm("DeleteArticle", "Article", FormMethod.Post))
                                                {
                                                    @Html.AntiForgeryToken(vngoodlife.Util.AntiKey.EditSalt)
                                                    @Html.Hidden("articleID", item.ArticleID)

                                                    <input class="SubmitDelete" type="submit" value="" onclick="javascript: if (confirm('Bạn muốn xóa bài viết này tin này?')) { window.location.href='#' } else { return false; };"/>
                                                }
                                            </td>
                                        </tr>
                                         }
                                    </tbody>
                                </table>
                                <div id="tablefooter">
                                    <div id="tablenav">
                                        <div>
                                            <img alt="" src="../../../Content/table/images/first.gif" />
                                            <img src="../../../Content/table/images/first.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1,true)" />
                                            <img src="../../../Content/table/images/previous.gif" width="16" height="16" alt="First Page"
                                                onclick="sorter.move(-1)" />
                                            <img src="../../../Content/table/images/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                                            <img src="../../../Content/table/images/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                                        </div>
                                        <div>
                                            <select id="pagedropdown"></select>
                                        </div>
                                        <div>
                                            <a href="javascript:sorter.showall()">Xem tất cả</a>
                                        </div>
                                    </div>
                                    <div id="tablelocation">
                                        <div>
                                            <select onchange="sorter.size(this.value)">
                                                <option value="5">5</option>
                                                <option value="10">10</option>
                                                <option value="20" selected="selected">20</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
                                            </select>
                                            <span>Kết quả mỗi trang</span>
                                        </div>
                                        <div class="page">
                                            Trang
                                            <span id="currentpage"></span>
                                            của
                                            <span id="totalpages"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <script type="text/javascript" src="../../../Content/table/4.js"></script>
                            <script type="text/javascript">
                                var sorter = new TINY.table.sorter('sorter', 'table', {
                                    headclass: 'head',
                                    ascclass: 'asc',
                                    descclass: 'desc',
                                    evenclass: 'evenrow',
                                    oddclass: 'oddrow',
                                    evenselclass: 'evenselected',
                                    oddselclass: 'oddselected',
                                    paginate: true,
                                    size: 20,
                                    colddid: 'columns',
                                    currentid: 'currentpage',
                                    totalid: 'totalpages',
                                    startingrecid: 'startrecord',
                                    endingrecid: 'endrecord',
                                    totalrecid: 'totalrecords',
                                    hoverid: 'selectedrow',
                                    pageddid: 'pagedropdown',
                                    navid: 'tablenav',
                                    /*
                                    sortcolumn: 0,
                                    sortdir: -1,
                                    sum:[8],
                                    avg:[6,7,8,9],
                                    columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}], */
                                    init: true
                                });
                            </script>
                        </td>
                    </tr>
                </table>